def fibonacci(n):

    terms = [0,1]
    i = 2
    while i <= n:
        terms.append(terms[i-1]+terms[i-2])

        i += 1

    # used for debugging
    #return terms

    return terms[n]

def recursiveFibonacci(n):

    if n < 2:
        return n
    else:
        return ( recursiveFibonacci(n-1)+recursiveFibonacci(n-2) )

# The last function looks very elegant, put involves many function calls which makes it a lot slower then the first function!


